import React, { useState, useEffect } from "react";
import Input from "../../components/input";
import Menu from "../../hoc/menu";

import Swiper from "../../components/swiper";
import AuthorCom from "./authorCom";
import Youth from "./youth";
import NewAuthor from "../common/newAuthor";
// import style from "../../components/swiper.css"
// const {wai} =style
import "../../App.css";
import "../../components/swiper.css";

import { getEbook_author } from "../../components/api";
// import { isConstructorDeclaration } from 'typescript'

export interface IAuthor {
  id: number;
  name: string;
  [propName: string]: any;
}

export interface IAuthorList {
  title?: string;
  list?: IAuthor;
}
function Book() {
  let [authorList, setAuthorList] = useState<IAuthorList>({});
  const getAuthor = async () => {
    let res = await getEbook_author();
    // console.log(res)
    setAuthorList(res.data[0]);
    // console.log(authorList, "author")
  };

  useEffect(() => {
    getAuthor();
  }, []);
  return (
    <div>
      <div className="qw">
        <Input></Input>
      </div>
      <div className="wai">
        <Swiper></Swiper>
        <AuthorCom></AuthorCom>
        <NewAuthor authorList={authorList}></NewAuthor>
        <Youth />
        <Youth />
      </div>
    </div>
  );
}
export default Menu(Book);
